package com.computer.network.util;

import java.io.Serializable;
import java.util.HashMap;

/**
 * 重写hashMap put方法，实现相同K时，Value相加
 *
 * @Author cgs
 * @Date 2022/9/13 15:03
 */
public class MyHashMap extends HashMap implements Serializable {
    @Override
    public Object put(Object key, Object value) {
        String newV = (String) value;
        if (containsKey(key)) {
            String oldV = (String) get(key);
            newV = oldV + "," + newV;
        }
        return super.put(key, newV);
    }
}
